<%--
  Created by IntelliJ IDEA.
  User: Thinkbook
  Date: 2021/7/10
  Time: 10:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

    <link href="https://saishi.cnki.net/resource/css/2017/reset.css?v=1807361.77" rel="stylesheet"/>
    <link href="https://saishi.cnki.net/resource/css/2017/style.css?v=1807361.77" rel="stylesheet"/>
    <link href="https://saishi.cnki.net/resource/css/CSS-reset.css?v=1807361.77" rel="stylesheet"/>
    <link href="https://saishi.cnki.net/resource/css/2017/paper.css?v=1807361.77" rel="stylesheet"/>
    <link href="https://saishi.cnki.net/resource/wap/font-awesome/css/font-awesome.min.css?v=1807361.77" rel="stylesheet"/>
    <style>
        #day{
            color: #0C0C0C;
        }
        .ds{
            width: 200px;
            height:90px;
            background: yellow;
            display:none;
        }
    </style>
</head>
<body>

<div class="paper-body">，
    <div class="paper-top">
        <div class="container">
            <div class="submenu clearfix" style="position:relative;">
                <a href="#" class="submenu-item " id="btn-shoucang" data-type="1">收藏</a>
                <a href="#" class="submenu-item submenu-share" id="btn-share">分享</a>
                <div style="display:none;" class="bdsharebuttonbox mp-share-tip" id="share-box">
                    <a class="bds_weixin" data-cmd="weixin"></a>
                    <a class="bds_sqq" data-cmd="sqq"></a>
                    <a class="bds_tsina" data-cmd="tsina"></a>
                </div>
            </div>
            <div class="title-container">
                <div class="title">试卷名:${pan.get(0).getcName()}</div>
                <div class="name">用户名:${BhSyUser.getuName()}</div>
            </div>
            <div class="info">
                <span class="font-bold">满分：</span>总分&nbsp;&nbsp;
                <span class="font-bold">题量：</span>共多少题&nbsp;&nbsp;
                <span class="font-bold">限时：</span>有小时
            </div>
            <div class="date">
                <span class="font-bold">考试时间：</span>
                ${pan.get(0).getcBegin()}                     ——
                ${pan.get(0).getcEnd()}
            <div class="content-outer">
                <div class="ds">
                    <a href="#" target="_blank" style="text-decoration:underline;">关闭</a><br><br>
                   <table class="ta">考试未开始请勿进入</table>
                </div>
            </div>

            <div class="btn btn3"><a href="#" id="day" onclick="quan()"></a></div>
        </div>
    </div>
    </div>
</div>
<script type="text/javascript">
    var day=document.querySelector("#day");
    var az=${Tim*1};
    var key = setInterval(function () {
        if (az == -1) {
            day.innerHTML = "考试已结束"
            clearInterval(key);
        } else if (az ==0) {
            day.innerHTML = "考试已开始";
            day.href = "UserBhSy/Login";
        } else {
            az -= 1000;
            day.innerHTML = time(az);
        }
    }, 1000);

    function  quan(){
        console.log(az);
        if(az==-1){
            alert("考试已结束");
        }else if (az>0) {
            alert("考试还未开始");
        }
    }
    function time(timea) {
        var days = Math.floor(timea / (24 * 3600 * 1000));
        //计算出小时数
        var leave1 = timea % (24 * 3600 * 1000);
        //计算天数后剩余的毫秒数
        var hours = Math.floor(leave1 / (3600 * 1000));
        //计算相差分钟数
        var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
        var minutes = Math.floor(leave2 / (60 * 1000));
        //计算相差秒数
        var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
        var seconds = Math.round(leave3 / 1000);
        if(days!=0){
            return days+"天之后开始"
        }else if(hours!=0){
            return hours + "小时后开始";
        }else if(minutes!=0){
            return  minutes + " 分钟后开始"
        }
        return  seconds + "秒后开始"
    }
</script>
</body>
</body>
</html>
